package com.unalm.examensustitutorio.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Query;

import com.unalm.examensustitutorio.util.entity.ETipoExamen;
import com.unalm.examensustitutorio.util.entity.EUsuario;


public class DTipoExamen implements IDTipoExamen{
	
	private EntityManagerFactory emf;
	private EntityManager em;
	
	
	public void setEmf(EntityManagerFactory emf) {
		this.emf = emf;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<ETipoExamen> listarTipoExamen() {
		List<ETipoExamen> lstTipoExamen = null;
		em = emf.createEntityManager();
		try {
			Query consulta = em.createQuery("select e from ETipoExamen e ");

			lstTipoExamen = consulta.getResultList();

		} catch (Exception e) {

			e.printStackTrace();
		} finally {
			em.close();
		}

		return lstTipoExamen;
	}

		
}
